password entry: Don't show both icons
authorMatthias Clasen <mclasen@redhat.com>
Fri, 15 Mar 2019 18:35:25 +0000 (14:35 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 15 Mar 2019 18:35:25 +0000 (14:35 -0400)
It can be a bit confusing to have an indicator
and an action next to each other, and with the
peek icon, the need for the Caps Lock warning is
reduced, since you can just reveal the text to
see that it is capitalized.

Therefore, only show the Caps Lock warning if
the peek icon is disabled.

gtk/gtkpasswordentry.c

index 7dc6603a59b5c2c9f0a5dbd1089ad7177302f3aa..ef6f1d815b992ffefb58a282d2e5f5de1da4e39a 100644 (file)
@@ -85,7 +85,8 @@ keymap_state_changed (GdkKeymap *keymap,
 
   if (gtk_editable_get_editable (GTK_EDITABLE (entry)) &&
       gtk_widget_has_focus (priv->entry) &&
-      gdk_keymap_get_caps_lock_state (priv->keymap))
+      gdk_keymap_get_caps_lock_state (priv->keymap) &&
+      !priv->peek_icon)
     gtk_widget_show (priv->icon);
   else
     gtk_widget_hide (priv->icon);
@@ -449,6 +450,8 @@ gtk_password_entry_set_show_peek_icon (GtkPasswordEntry *entry,
       gtk_text_set_visibility (GTK_TEXT (priv->entry), FALSE);
     }
 
+  keymap_state_changed (priv->keymap, GTK_WIDGET (entry));
+
   g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_SHOW_PEEK_ICON]);
 }